package com.cxd.service.impl;

import com.cxd.entity.EbProduct;
import com.cxd.mapper.EbProductMapper;
import com.cxd.service.IEbProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EbProductServiceImpl implements IEbProductService {
    @Autowired
    private EbProductMapper productMapper;
    @Override
    public List<EbProduct> listByPage(Integer page, Integer pageSize) {
        Integer from = (page - 1)*pageSize;
        return productMapper.findByPage(from,pageSize);
    }

    @Override
    public List<EbProduct> listByCategory(Integer id, Integer page, Integer pageSize) {
        return productMapper.listByCategory(id,page,pageSize);
    }


    @Override
    public EbProduct selectByCondition(Integer epId) {
        return null;
    }
    @Override
    public int updateById(EbProduct ebProduct) {
        return 0;
    }
    @Override
    public int delete(Integer epId) {
        return 0;
    }

    @Override
    public Integer findTotalPage(Integer pageSize) {
        return productMapper.getTotalPage(pageSize);
    }

    @Override
    public Integer save(EbProduct ebProduct){
        return productMapper.save(ebProduct);
    }

    @Override
    public EbProduct selectOne(Integer epId) {
        return productMapper.selectOne(epId);
    }
    @Override
    public Integer updateProduct(EbProduct ebProduct){
        return productMapper.updateByPrimaryKey(ebProduct);
    }

    @Override
    public int deleteByPk(int id) {
        return productMapper.deleteByPk(id);
    }


}
